﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Globalization;

namespace _04.SortThreeRealNumbersInDescendenting
{
    class SortThreeRealNumbers
    {
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Console.WriteLine("Insert three integer numbers");
            Console.Write("a= ");
            string first = Console.ReadLine();
            Console.Write("b= ");
            string second = Console.ReadLine();
            Console.Write("c= ");
            string third= Console.ReadLine();
            int a,b,c;
            //check if is int
            if (int.TryParse(first, out a))
            {
                Console.Write("");
            }
            else
            {
                Console.WriteLine("a is not an ingeter.Please insert int number");
            } 
            if (int.TryParse(second, out b))
            {
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine("b is not an ingeter.Please insert int number");
            } 
            if (int.TryParse(third, out c))
            {
                Console.Write("");
            }
            else
            {
                Console.WriteLine("c is not an ingeter.Please insert int number");
            }
            //check if a is biggest number
            Console.ForegroundColor = ConsoleColor.DarkCyan;
            if (a > c && a > b)
            {
                Console.WriteLine("a is the biggest number - {0}", a);
                if (b > c)
                {
                    Console.WriteLine("b is the second number - {0} \n and the smallest number is c = {1}", b, c);
                }
                else
                {
                    if (b == c)
                    {
                        Console.WriteLine("There are two smallest numbers a = {0}; b = {1}", a, b);
                    }
                    else
                    {
                        Console.WriteLine("c is the second number - {0} \n and the smallest number is b = {1}", c, b);
                    }
                }
            }
                //check if b is biggest number
            else if (b > c && b > a)
            {
                Console.WriteLine("b is the biggest number - {0}", b);
                if (a > c)
                {
                    Console.WriteLine("a is the second number - {0} \n and the smallest number is c = {1}", a, c);
                }
                else
                {
                    if (a == c)
                    {
                        Console.WriteLine("There are two smallest numbers a = {0}; c = {1}", a, c);
                    }
                    else
                    {
                        Console.WriteLine("c is the second number - {0} \n and the smallest number is a = {1}", c, a);
                    }
                }
            }
            //check if c is biggest numberelse if (b > c && b > a)
            else if(c>a && c >b)
            {
                Console.WriteLine("c is the biggest number - {0}", c);
                if (a > b)
                {
                    Console.WriteLine("a is the second number - {0} \n and the smallest number is b = {1}", a, b);
                }
                else
                {
                    if (a == b)
                    {
                        Console.WriteLine("There are two smallest numbers a = {0}; b = {1}", a, b);
                    }
                    else
                    {
                        Console.WriteLine("b is the second number - {0} \n and the smallest number is a = {1}", b, a);
                    }
                }
            }
            //check if three numbers are equal
            else if (a == b && a == c)
            {
                Console.WriteLine("These numbers are equal a = {0}; b = {1}; c = {2}", a, b, c);
            }
            else
            {
                if (a == b && a > c)
                {
                    Console.WriteLine("There are two biggest numbers a = {0} b = {1} \n  and c is the smallest number c = {2}", a, b, c);
                }
                else if (a == b && a < c)
                {
                    Console.WriteLine("c is the biggest number c = {0} \n and the smallest numbers are a = {1} and b = {2}", c, a, b);
                }
                else if (a == c && a > b)
                {
                    Console.WriteLine("There are two biggest numbers a = {0} c = {1}\n  and b is the smallest number c = {2}", a, c, b);
                }
                else if(a==c && a<b)
                {
                    Console.WriteLine("b is the biggest number b = {0} \n and the smallest numbers are a = {1} and c = {2}", b, a, c);
                }
                else if(b==c && b>a)
                {
                    Console.WriteLine("There are two biggest numbers b = {0} c = {1} \n and a is the smallest number c = {2}", b, c, a);  
                }
                else 
                {
                    Console.WriteLine("a is the biggest number a = {0} \n and the smallest numbers are b = {1} and c = {2}", a, b, c);
                }
            }

        }
    }
}
